Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Display queue runtime in human readable format #47227

Merged

Conversation

michaeldyrynda
Copy link
Contributor

Currently, queue runtime is displayed in milliseconds (ms suffix), which is fine in many scenarios where tasks are short-lived and it is clear how long a job ran.

For longer running tasks, beyond say 10 seconds (10,000.00ms), the runtime is not so easily parseable.

I have had queued jobs that run for 828,320.11ms, which is difficult to reason about at a glance.

This PR introduces formatting of the runtime to human-readable notation for runtimes exceeding 1sec (1,000ms);

# Before
2023-05-25 23:35:26 App\Jobs\SomeLongRunningTask .......... 828,420.11ms DONE
# After
2023-05-25 23:35:26 App\Jobs\SomeLongRunningTask ............... 13m 48s DONE

@michaeldyrynda michaeldyrynda force-pushed the chore/queue-runtime-for-humans branch 2 times, most recently from e8ada04 to b1a3f48 Compare May 26, 2023 00:45
@GC-Mark
Copy link

GC-Mark commented May 26, 2023

Would like this for migrations too 🙏

@taylorotwell
Copy link
Member

If I create a job and put sleep(2) in the handle method it never shows as DONE for me after this PR:

CleanShot 2023-05-30 at 09 44 10@2x

@taylorotwell taylorotwell marked this pull request as draft May 30, 2023 14:44
@michaeldyrynda michaeldyrynda force-pushed the chore/queue-runtime-for-humans branch from c5b0e9c to 8bd3353 Compare May 31, 2023 00:52
@michaeldyrynda michaeldyrynda force-pushed the chore/queue-runtime-for-humans branch from 8bd3353 to f7c2f55 Compare May 31, 2023 00:57
@michaeldyrynda
Copy link
Contributor Author

Got it; you can no longer compare a string (result of number_format and integer (1000)). Separated the calculation from the formatting and have a happy camper now.

CleanShot 2023-05-31 at 10 37 58

@michaeldyrynda
Copy link
Contributor Author

I'm not sure why there is an (pretty sure) unrelated test failure in the Windows tests, though.

@michaeldyrynda michaeldyrynda marked this pull request as ready for review June 1, 2023 00:17
@michaeldyrynda
Copy link
Contributor Author

@driesvints mentioned the failing test is a known intermittent failure (he re-ran for me, but still no good)

The introduced functionality is otherwise working as expected now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants